--所见即行
local suojianjixing = fk.CreateSkill {
    name = "mcdh_suojianjixing",
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

suojianjixing:addEffect(fk.TargetConfirmed,{
    can_trigger = function(self, event, target, player, data)
        if not player:hasSkill(self) then return false end
        return player:getHandcardNum() > target:getHandcardNum()
                and data.card.is_damage_card
    end,
    on_cost = function(self, event, target, player, data)
        local room = player.room
        local card = room:askForCard(
                player,
                1, 1,
                false,
                self.name,
                true,
                ".",
                "#mcdh_suojianjixing-choice:" .. target.id
        )
        if #card > 0 then
            self.cost_data = card
            return true
        end
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        room:obtainCard(
                target,
                self.cost_data,
                true,
                fk.ReasonGive,
                player,
                self.name
        )
    end
})

Fk:loadTranslationTable{
    ["mcdh_suojianjixing"] = "所见即行",
    [":mcdh_suojianjixing"] = "当手牌数小于你的角色成为伤害牌的目标后，你可以将一张手牌正面朝上交给其。",
    ["#mcdh_suojianjixing-choice"] = "所见即行:交给 %src 一张手牌",
}

return suojianjixing